package com.common.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import com.common.template.AbstractModuleInit;

import cn.hutool.core.collection.CollectionUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @ficus 模块初始化管理类
 * 
 */
@Component
@Slf4j
public class ModuleInitServiceManager implements ApplicationRunner {
	
	@Autowired(required = false)
	private List<AbstractModuleInit> beanList;
	

	@Override
	public void run(ApplicationArguments args) throws Exception {
		if(CollectionUtil.isNotEmpty(beanList)) {
			beanList.forEach(item->{
				log.info("开始初始化模块数据....."+item.getClass());
				item.init();
			});
		}
	}
}
